package com.book.oauth.server.model.hystrix;

import com.book.common.result.RestResponse;
import com.book.common.result.PageInfo;
import com.book.oauth.server.model.dto.ModelDto;
import com.book.oauth.server.model.vo.ModelVo;
import com.book.oauth.server.model.hystrix.impl.ModelHystrixImpl;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.List;

/**
 * Description：模块 Hystrix
 *
 * @Author： leo.xiong
 * @CreateDate： 2020-05-26
 * @Email： leo.xiong@suyun360.com
 * Version:
 */
@FeignClient(value = "oauth-server", fallbackFactory = ModelHystrixImpl.class)
public interface IModelHystrix {
    /**
     * 根据ID获取模块信息
     *
     * @param id
     * @return
     */
    @GetMapping(value = "/server/model/{id}")
    RestResponse<ModelVo> get(@PathVariable(value = "id") String id);

    /**
     * 查询模块信息
     *
     * @param modelDto
     * @return
     */
    @PostMapping(value = "/server/model/list")
    RestResponse<List<ModelVo>> list(@RequestBody ModelDto modelDto);

    /**
     * 查询模块信息
     *
     * @param modelDto
     * @return
     */
    @PostMapping(value = "/server/model/page/list")
    RestResponse<PageInfo<ModelVo>> pageList(@RequestBody ModelDto modelDto);

    /**
     * 新增模块信息
     *
     * @param modelDto
     * @return
     */
    @PostMapping(value = "/server/model/save")
    RestResponse<String> save(@RequestBody ModelDto modelDto);

    /**
     * 修改模块信息
     *
     * @param modelDto
     * @return
     */
    @PutMapping(value = "/server/model/update")
    RestResponse<String> update(@RequestBody ModelDto modelDto);

    /**
     * 删除模块信息
     *
     * @param id
     * @return
     */
    @DeleteMapping(value = "/server/model/delete/{id}")
    RestResponse<String> delete(@PathVariable(value = "id") String id);

    /**
     * 导出模块模板信息
     *
     * @return
     */
    @PostMapping(value = "/server/model/export/template")
    RestResponse<String> exportTemplate();

    /**
     * 导出模块信息
     *
     * @param modelDto
     * @return
     */
    @PostMapping(value = "/server/model/export/excel")
    RestResponse<String> exportExcel(@RequestBody ModelDto modelDto);

    /**
     * 导入模块信息
     *
     * @param filePath
     * @return
     */
    @PostMapping(value = "/server/model/import/excel")
    RestResponse<String> importExcel(@RequestParam(value = "filePath") String filePath);

}
